using CommunityToolkit.Mvvm.ComponentModel;
using GoChat_for_Windows.Services;

namespace GoChat_for_Windows.ViewModels
{
    public abstract class ViewModelBase : ObservableObject
    {
        protected readonly IApiService ApiService;

        protected ViewModelBase(IApiService apiService)
        {
            ApiService = apiService;
        }

        private bool isBusy;
        public bool IsBusy
        {
            get => isBusy;
            set => SetProperty(ref isBusy, value);
        }

        private string errorMessage;
        public string ErrorMessage
        {
            get => errorMessage;
            set => SetProperty(ref errorMessage, value);
        }

        protected void ClearError()
        {
            ErrorMessage = string.Empty;
        }
    }
} 